package com.zupig.livewallpaper;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    protected Button btnSetWallPaper;
    protected CheckBox cbControlVoice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.activity_main);
        initView();
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.btn_set_wall_paper) {
            LiveWalPaper.setToWallPaper(this);
        }
    }

    private void initView() {
        btnSetWallPaper = (Button) findViewById(R.id.btn_set_wall_paper);
        btnSetWallPaper.setOnClickListener(MainActivity.this);
        cbControlVoice = (CheckBox) findViewById(R.id.cb_control_voice);
        cbControlVoice.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    LiveWalPaper.setVoiceNormal(MainActivity.this);
                }else {
                    LiveWalPaper.setVoiceSilence(MainActivity.this);
                }
            }
        });
    }
}
